﻿using System;
using Team4Mock.DAO;
using System.Data;
namespace Team4Mock.Entity
{
   
    public class TrustDistrictEntity
    {
        TrustDistrictDAO td=new TrustDistrictDAO();
        private string trustDistrictName;
        private string description;
        private int trustRegionId;
        private int trustDistrictId;
        private string key;

        public string Key
        {
            get { return key; }
            set { key = value; }
        }
        private int isActive;
        public TrustDistrictEntity()
        { }
        public TrustDistrictEntity(string trustDistrictName, string description, int trustRegionId, int isActive)
        {
            this.trustDistrictName = trustDistrictName;
            this.description = description;
            this.trustRegionId = trustRegionId;
            this.isActive = isActive;
        }
        public int TrustDistrictId
        {
            get { return trustDistrictId; }
            set { trustDistrictId = value; }
        }
        public string TrustDistrictName
        {
            get { return this.trustDistrictName; }
            set
            {
                if (value == null)
                    throw new Exception("trustDistrictName not allow nullvalue.");
                this.trustDistrictName = value;
            }
        }
        public string Description
        {
            get { return this.description; }
            set { this.description = value; }
        }
        public int TrustRegionId
        {
            get { return this.trustRegionId; }
            set
            {
                if (value == 0)
                    throw new Exception("trustRegionId not allow nullvalue.");
                this.trustRegionId = value;
            }
        }
        public int IsActive
        {
            get { return this.isActive; }
            set
            {
                this.isActive = value;
            }
        }
        public void Insert(TrustDistrictEntity e)
        {
            td.Insert(e.TrustDistrictName,e.Description,e.TrustRegionId,e.IsActive);
        }
        public void Update(TrustDistrictEntity e)
        {
            td.Update(e.TrustDistrictName, e.Description, e.IsActive,e.TrustDistrictId);
        }
        //get by region
        public DataTable Getdata(TrustDistrictEntity e)
        {
            return td.Getdata(e.TrustRegionId);
        }
        //get by dis
        public DataTable GetdataByDIs(TrustDistrictEntity e)
        {
            return td.GetdataByDis(e.TrustDistrictId);
        }
        public string GetNameRegion(TrustDistrictEntity e)
        {
            return td.GetnameRegion(e.TrustRegionId);
        }
        
    }
}